const qs = require('querystring');

var str = 'username=jack&age=18'
var obj = qs.parse(str)

console.log(obj) //  { username: 'jack', age: '18' }